package br.com.ava.core.pessoa;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
@Table(name = "pessoa_fisica")
@PrimaryKeyJoinColumn(name = "idpessoa")
@SuppressWarnings("serial")
public class PessoaFisica extends Pessoa {

	private String cpf;
	private String rg;
	private String usuario;
	private Character sexo;

	public PessoaFisica() {
		super();
		this.sexo = 'M';
	}

	public PessoaFisica(String nome, String telefone, String email,
			String endereco, String cpf, String rg, String usuario,
			Character sexo) {
		super(nome, telefone, email, endereco);
		this.cpf = cpf;
		this.rg = rg;
		this.usuario = usuario;
		this.sexo = sexo;
	}

	@NotNull
	@Size(max = 14)
	@Column(name = "cpf", nullable = false)
	public String getCpf() {
		return cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	@NotNull
	@Size(max = 8)
	@Column(name = "rg", nullable = false)
	public String getRg() {
		return rg;
	}

	public void setRg(String rg) {
		this.rg = rg;
	}

	@Transient
	public String getUsuario() {
		return usuario;
	}

	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}

	@NotNull
	@Column(name = "sexo", nullable = false)
	public Character getSexo() {
		return sexo;
	}

	public void setSexo(Character sexo) {
		this.sexo = sexo;
	}
}
